package demo5;

import demo10.Subject;
import org.apache.hadoop.mapreduce.Partitioner;

public class MyPartitioner extends Partitioner<DescIntWritable, Subject> {
    @Override
    public int getPartition(DescIntWritable descIntWritable, Subject subject, int numPartitions) {
        int num = 0;
        switch (subject.getSubject()){
            case "语文":
                num = 0;
                break;
            case "数学":
                num = 1;
                break;
            case "英语":
                num = 2;
                break;
            default:
                num = 3;
                break;
        }
        return num;
    }
}
